
#include "stdafx.h"
#include "wf_blocksfreezeall.h"

#include "pf_graphic.h"



WF_BlocksFreezeAll::WF_BlocksFreezeAll(bool freeze,
        PF_Container& container,
        PF_GraphicView& graphicView)
        :PF_ActionInterface("Freeze all Blocks",
                    container, graphicView) {

    this->freeze = freeze;
}

QAction* WF_BlocksFreezeAll::createGUIAction(LX_Define::ActionType type, QObject* /*parent*/) {
    QAction* action = NULL;
	
	if (type==LX_Define::ActionBlocksFreezeAll) {
		// tr("Freeze all")
		action= new QAction(tr("&Freeze all"), NULL);
    	//action->zetStatusTip(tr("Freeze all blocks"));
		action->setIcon(QIcon(":/ui/blockfreeze.png"));
	}
	else if (type==LX_Define::ActionBlocksDefreezeAll) {
		// tr("&Defreeze all")
		action = new QAction(tr("&Defreeze all"), NULL); 
        //action->zetStatusTip(tr("Defreeze all blocks"));
		action->setIcon(QIcon(":/ui/blockdefreeze.png"));

	}

    return action;
}


void WF_BlocksFreezeAll::trigger() {
    PF_DEBUG->print("PF_ActionBlocksFreezeAll::trigger");
    if (graphic!=NULL) {
        graphic->freezeAllBlocks(freeze);
    }
	graphicView->redraw(LX_Define::RedrawDrawing); 

    finish();
}



void WF_BlocksFreezeAll::init(int status) {
    PF_ActionInterface::init(status);
    trigger();
}

// EOF
